package com.frain.springcloud.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.frain.springcloud.test.entity.User;
import com.frain.springcloud.test.service.UserService;

/**
 * 
 * @ClassName: UserController 
 * @Description: mybatis测试代码 
 * @author frain
 * @date 2018年8月8日 下午3:10:51 
 *
 */

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("/findOne")
    public User findUser(Long id) {

        System.out.println("id===" + id);
        return userService.findUserById(id);

    }

    @RequestMapping("/findOneUser")
    public User findUser(@RequestBody User user) {

        System.out.println("user===" + user);
        return userService.findUserById(user.getId());

    }

}
